<%@page import="helpers.DateHelper"%>
<%@page import="java.util.TreeMap"%>
<%@page import="helpers.LanguageHelper"%>
<%@page import="helpers.StringHelper"%>
<%@page import="helpers.UrlHelper"%>
<%@page import="com.google.appengine.api.blobstore.BlobKey"%>
<%@page import="com.google.appengine.api.images.ImagesService"%>
<%@page import="com.google.appengine.api.images.ImagesServiceFactory"%>
<%@page import="com.google.appengine.api.blobstore.BlobstoreServiceFactory"%>
<%@page import="com.google.appengine.api.blobstore.BlobstoreService"%>
<%@page import="entities.User"%>
<%@page import="helpers.PaginatorHelper"%>
<%@page import="java.util.List"%>
<%
List<User> authors = (List<User>) request.getAttribute("authors");
BlobstoreService blobstoreService = BlobstoreServiceFactory.getBlobstoreService();
ImagesService imagesService = ImagesServiceFactory.getImagesService();

//Paginator
int pages = (Integer) request.getAttribute("page");
boolean nextPage = (Boolean) request.getAttribute("nextPage");
boolean prevPage = (Boolean) request.getAttribute("prevPage");
PaginatorHelper paginator = (PaginatorHelper) request.getAttribute("paginator");
LanguageHelper translate = (LanguageHelper) request.getAttribute("translate");

//Set content for seo
String nameServer = UrlHelper.getDomainServer(request);

String title = "Author Listing in  - page " + pages ;
String description = "Author listing submit article in " + nameServer ;
String keywords = "author, authors list, archives, archives article, submit article, article commit";
String url = UrlHelper.getServerUrl(request) + "/authors";
%>
<%@ page language="java" contentType="text/html; charset=UTF-8" pageEncoding="UTF-8"%>
<jsp:include page="/templates/classic/layouts/header.jsp">
	<jsp:param name="title" value="<%=title %>" />
    <jsp:param name="description" value="<%=description %>" />
    <jsp:param name="keywords" value="<%=keywords %>" />
    <jsp:param name="ogtitle" value="<%=title %>" />
    <jsp:param name="ogurl" value="<%=url %>" />
    <jsp:param name="ogdescription" value="<%=description%>" />
</jsp:include>
		<div id="wrapper">
			
			<div class="row-fluid">
				<div class="span8 left-content">
					<div class="title">
						<h3>Authors</h3>
					</div>
					<% for (int i = 0; i < authors.size(); i++) { %>
					<div class="author">
						<div class="clearfix">
							<div class="pull-left author-image">
								<a href="/author/<%=authors.get(i).getId()%>">
								<% 
								if (authors.get(i).getAvatar() != null && !authors.get(i).getAvatar().isEmpty())  {
									 BlobKey blobKey = new BlobKey(authors.get(i).getAvatar());
								%>
								<img alt="" src="<%=imagesService.getServingUrl(blobKey) %>=s60-c" class="left" >
								<% } else { %>							
								<img itemprop="image" src="/templates/classic/images/icon-author.jpg" width="60" class="left" />
								<% } %>
								</a>
							</div>
							<div class="pull-left author-info">
								<a class="author_name" href="/author/<%=authors.get(i).getId()%>"><%=authors.get(i).getName() %></a>
								<span>Joined: <%=DateHelper.getStringFromDate(authors.get(i).getCreated(), "MMM, dd yyyy") %></span> | 
								<span>Website: <%=authors.get(i).getWebsite() %></span>
								<p>
								<strong>About Me: </strong> <%=authors.get(i).getAboutme() %></p>
							</div>
						</div>
					</div>
					<% } %>
					
				</div>
				
				<jsp:include page="/templates/classic/elements/right.jsp" />
				
			</div>
		</div>
		
<jsp:include page="/templates/classic/layouts/footer.jsp" />